#include "returnmain.h"
#include "ui_returnmain.h"

ReturnMain::ReturnMain(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ReturnMain)
{
    ui->setupUi(this);
    bdf = BllDataFlow::getInstance();
    connect(bdf, &BllDataFlow::endExperimentSignal, this, &ReturnMain::setEnableSlot);
    connect(bdf, &BllDataFlow::retranslateUiSignal, this, &ReturnMain::retranslateUiSlot);

    if (windowWidth >= 1280) {
        this->setProperty("cssSize", "large");
        ui->pushButton->setIconSize(QSize(42,37));
    }
}

ReturnMain::~ReturnMain()
{
    delete ui;
}

void ReturnMain::on_pushButton_clicked()
{
    bdf->changeMainPageIndex(MainPageIndex::MAIN);
}

void ReturnMain::setEnableSlot(bool state)
{
    ui->pushButton->setEnabled(state);
    ui->pushButton->setVisible(state);
}

void ReturnMain::retranslateUiSlot()
{
    ui->retranslateUi(this);
}
